from typing import *

from bisect import bisect_left,bisect_right


class Solution:

    def minEatingSpeed(self, piles: List[int], h: int) -> int:

        return bisect_left(range(1,
                                 max(piles) + 1),
                           True,
                           key=lambda a: sum(
                               (v + a - 1) // a for v in piles) <= h) + 1
    

class Solution:

    def minEatingSpeed(self, piles: List[int], h: int) -> int:

        return bisect_right(range(1,
                                 max(piles) + 1),
                           False,
                           key=lambda a: sum(
                               (v + a - 1) // a for v in piles) <= h) + 1
    
    
class Solution:

    def minEatingSpeed(self, piles: List[int], h: int) -> int:

        return bisect_left(range(1,
                                 max(piles) + 1),
                           -h,
                           key=lambda a: -sum(
                               (v + a - 1) // a for v in piles)) + 1


[3, 6, 7, 11]
8
[30, 11, 23, 4, 20]
5
[30, 11, 23, 4, 20]
6
[312884470]
968709470
